home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Gobby 0.4.7 / gobby-0.4.7.exe / {app} / share / gtksourceview-2.0 / language-specs / xml.lang < prev    next >
Extensible Markup Language  |  2008-09-09  |  9KB  |  217 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.  Authors: Marco Barisione, Emanuele Aina, Paolo Borelli
  5.  Copyright (C) 2005-2007 Marco Barisione <barisione@gmail.com>
  6.  Copyright (C) 2005-2007 Emanuele Aina
  7.  Copyright (C) 2007 Paolo Borelli
  8.  
  9.  This library is free software; you can redistribute it and/or
  10.  modify it under the terms of the GNU Library General Public
  11.  License as published by the Free Software Foundation; either
  12.  version 2 of the License, or (at your option) any later version.
  13.  
  14.  This library is distributed in the hope that it will be useful,
  15.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17.  Library General Public License for more details.
  18.  
  19.  You should have received a copy of the GNU Library General Public
  20.  License along with this library; if not, write to the
  21.  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  22.  Boston, MA 02111-1307, USA.
  23.  
  24. -->
  25. <language id="xml" _name="XML" version="2.0" _section="Markup">
  26.     <metadata>
  27.         <property name="mimetypes">application/xml;text/xml</property>
  28.         <property name="globs">*.xml;*.xspf;*.siv;*.smil;*.smi;*.sml;*.kino;*.xul;*.xbel;*.abw;*.zabw;*.glade;*.jnlp;*.xhtml;*.svg;*.mml;*.rdf;*.rss;*.wml;*.xmi;*.fo;*.xslfo;*.xslt;*.xsl</property>
  29.         <property name="block-comment-start"><!--</property>
  30.         <property name="block-comment-end">--></property>
  31.     </metadata>
  32.  
  33.     <styles>
  34.         <style id="comment"                 _name="Comment"                 map-to="def:comment"/>
  35.         <style id="doctype"                 _name="DOCTYPE"                 map-to="def:preprocessor"/>
  36.         <style id="cdata-delim"             _name="CDATA delimiter"         map-to="def:preprocessor"/>
  37.         <style id="processing-instruction"  _name="Processing instruction"  map-to="def:preprocessor"/>
  38.         <style id="element-name"            _name="Element name"            map-to="def:identifier"/>
  39.         <style id="attribute-name"          _name="Attribute name"          map-to="def:type"/>
  40.         <style id="attribute-value"         _name="Attribute value"         map-to="def:string"/>
  41.         <style id="entity"                  _name="Entity"                  map-to="def:preprocessor"/>
  42.         <style id="tag"                     _name="Tag"/>
  43.         <style id="namespace"               _name="Namespace"               map-to="xml:element-name"/>
  44.         <style id="error"                   _name="Error"                   map-to="def:error"/>
  45.     </styles>
  46.  
  47.     <definitions>
  48.         <define-regex id="prefix">[a-zA-Z_][a-zA-Z0-9._-]*</define-regex>
  49.  
  50.         <define-regex id="name">[a-zA-Z_][a-zA-Z0-9.:_-]*</define-regex>
  51.  
  52.         <context id="entity" style-ref="entity">
  53.             <match>&\%{name};</match>
  54.         </context>
  55.  
  56.         <context id="character-reference" style-ref="entity">
  57.             <match>&#([0-9]+|x[a-fA-F0-9]+);</match>
  58.         </context>
  59.  
  60.         <context id="unallowed-chars" style-ref="error" extend-parent="false">
  61.             <match>[&<]</match>
  62.         </context>
  63.  
  64.         <context id="comment" style-ref="comment">
  65.             <start><!--</start>
  66.             <end>--></end>
  67.             <include>
  68.                 <context style-ref="error" extend-parent="false">
  69.                     <match>--+</match>
  70.                 </context>
  71.                 <context ref="def:in-comment"/>
  72.             </include>
  73.         </context>
  74.  
  75.         <context id="doctype">
  76.             <start>(<!DOCTYPE)\s+(\%{name})</start>
  77.             <end>></end>
  78.             <include>
  79.               <context sub-pattern="1" where="start" style-ref="doctype"/>
  80.               <context sub-pattern="2" where="start" style-ref="doctype"/>
  81.               <context sub-pattern="0" where="end" style-ref="doctype"/>
  82.               <context>
  83.                 <match>(SYSTEM)\s+(\"[^\"]*\")</match>
  84.                 <include>
  85.                   <context sub-pattern="1" style-ref="doctype"/>
  86.                   <context sub-pattern="2" style-ref="attribute-value"/>
  87.                 </include>
  88.               </context>
  89.               <context>
  90.                 <match>(PUBLIC)\s+(\"[^\"]*\")\s+(\"[^\"]*\")</match>
  91.                 <include>
  92.                   <context sub-pattern="1" style-ref="doctype"/>
  93.                   <context sub-pattern="2" style-ref="attribute-value"/>
  94.                   <context sub-pattern="3" style-ref="attribute-value"/>
  95.                 </include>
  96.               </context>
  97.               <context>
  98.                 <start>\[</start>
  99.                 <end>\]</end>
  100.                 <include>
  101.                   <context sub-pattern="0" where="start" style-ref="doctype"/>
  102.                   <context sub-pattern="0" where="end" style-ref="doctype"/>
  103.                   <context ref="dtd:dtd"/>
  104.                 </include>
  105.               </context>
  106.             </include>
  107.         </context>
  108.  
  109.         <context id="cdata">
  110.             <start><!\[CDATA\[</start>
  111.             <end>\]\]></end>
  112.             <include>
  113.                 <context sub-pattern="0" where="start" style-ref="cdata-delim"/>
  114.                 <context sub-pattern="0" where="end" style-ref="cdata-delim"/>
  115.             </include>
  116.         </context>
  117.  
  118.         <context id="processing-instruction" style-ref="processing-instruction">
  119.             <start><\?</start>
  120.             <end>\?></end>
  121.         </context>
  122.  
  123.         <!-- The following three contexts can be <replace>d in xml
  124.              dialect lang files, to custommize highlighting, e.g.
  125.              highlighting docbook tags as keywords -->
  126.  
  127.         <context id="namespace" style-ref="namespace">
  128.             <match>(?<!:)\%{prefix}:</match>
  129.         </context>
  130.  
  131.         <context id="element-name" once-only="true" style-ref="element-name">
  132.             <match>\b\%{name}\b(?!\s*=)</match>
  133.         </context>
  134.  
  135.         <context id="attribute-name" style-ref="attribute-name">
  136.             <match>\b\%{name}\s*=</match>
  137.         </context>
  138.  
  139.         <context id="attribute-value" style-ref="attribute-value">
  140.             <start>["']</start>
  141.             <end>\%{0@start}</end>
  142.             <include>
  143.                 <context ref="entity"/>
  144.                 <context ref="character-reference"/>
  145.                 <context ref="unallowed-chars"/>
  146.             </include>
  147.         </context>
  148.  
  149.         <context id="prolog">
  150.             <start><\?xml</start>
  151.             <end>\?></end>
  152.             <include>
  153.                 <context sub-pattern="0" where="start" style-ref="processing-instruction"/>
  154.                 <context sub-pattern="0" where="end" style-ref="processing-instruction"/>
  155.                 <context ref="attribute-value"/>
  156.                 <context ref="attribute-name"/>
  157.             </include>
  158.         </context>
  159.  
  160.         <context id="start-tag" style-ref="tag">
  161.             <start><(?!/)</start>
  162.             <end>/?></end>
  163.             <include>
  164.                 <context sub-pattern="0" where="start" style-ref="element-name"/>
  165.                 <context sub-pattern="0" where="end" style-ref="element-name"/>
  166.                 <context ref="entity"/>
  167.                 <context ref="character-reference"/>
  168.                 <context ref="unallowed-chars"/>
  169.                 <context ref="namespace"/>
  170.                 <context ref="element-name"/>
  171.                 <context ref="attribute-name"/>
  172.                 <context ref="attribute-value"/>
  173.                 <context style-ref="error" extend-parent="false">
  174.                   <match>\S</match>
  175.                 </context>
  176.             </include>
  177.         </context>
  178.  
  179.         <context id="end-tag" style-ref="tag">
  180.             <start></</start>
  181.             <end>></end>
  182.             <include>
  183.                 <context sub-pattern="0" where="start" style-ref="element-name"/>
  184.                 <context sub-pattern="0" where="end" style-ref="element-name"/>
  185.                 <context ref="entity"/>
  186.                 <context ref="character-reference"/>
  187.                 <context ref="unallowed-chars"/>
  188.                 <context ref="namespace"/>
  189.                 <context ref="element-name"/>
  190.                 <context style-ref="error" extend-parent="false">
  191.                   <match>\S</match>
  192.                 </context>
  193.             </include>
  194.         </context>
  195.  
  196.         <context id="close-tag-outside-tag" style-ref="error">
  197.           <match>/></match>
  198.         </context>
  199.  
  200.         <context id="xml">
  201.             <include>
  202.                 <context ref="comment"/>
  203.                 <context ref="doctype"/>
  204.                 <context ref="cdata"/>
  205.                 <context ref="prolog"/>
  206.                 <context ref="processing-instruction"/>
  207.                 <context ref="start-tag"/>
  208.                 <context ref="end-tag"/>
  209.                 <context ref="entity"/>
  210.                 <context ref="character-reference"/>
  211.                 <context ref="unallowed-chars"/>
  212.                 <context ref="close-tag-outside-tag"/>
  213.             </include>
  214.         </context>
  215.     </definitions>
  216. </language>
  217.